package com.gt.admin.controller;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.gt.common.core.controller.BaseController;
import com.gt.common.core.domain.AjaxResult;
import com.gt.admin.domain.FlowScheme;
import com.gt.admin.domain.apiVO.FlowSchemeVO;
import com.gt.admin.service.IFlowSchemeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@Api(tags = "随访方案")
@RestController
@RequestMapping("/flow-scheme")
public class FlowSchemeController extends BaseController {
    @Autowired
    private IFlowSchemeService flowSchemeService;

    /** 查询随访方案列表 */
    @ApiOperation(value = "查询随访方案列表")
    @GetMapping("/list")
    public AjaxResult list(FlowScheme flowScheme){
        LambdaQueryWrapper<FlowScheme> queryWrapper = new LambdaQueryWrapper<>(flowScheme);
        return AjaxResult.success(flowSchemeService.list(queryWrapper));
    }

    /** 发布随访方案 */
    @ApiOperation(value = "发布随访方案")
    @PostMapping
    public AjaxResult publishPlan(@RequestBody FlowSchemeVO flowSchemeVO){
        return toAjax(flowSchemeService.publishPlan(flowSchemeVO));
    }
}
